Fix renaming a project using build scripts
authorAlex Crichton <alex@alexcrichton.com>
Thu, 14 Dec 2017 04:54:01 +0000 (20:54 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 18 Dec 2017 19:30:09 +0000 (11:30 -0800)
commitf0c0a6aaeea727d9bc8526e6a415b6ce9e4e0c26
treedfa92f4098902a5cb5b25376f5b6fa6501b28b05
parent9d05f7e5761cf185cb30b96ec3ce75748b3b1b3e
Fix renaming a project using build scripts

This commit fixes an issue in Cargo where if a project's folder was
renamed but it also contained a build script the project could break.
Cargo would continue to use the previous `rustc-link-search` arguments
to configure env vars like `LD_LIBRARY_PATH` but the literal values from
the previous compilation would be stale as the directories would no
longer be there.

To fix this when parsing the build script output we now retain a log of
the previous output directory of a build script invocation as well as
the current output, tweaking paths as appropriate if they were contained
in the output folder.

Closes #4053
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/mod.rs
tests/build-script.rs